package com.ikangtai.shecare.common.baseView.recordButtonView;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;

import com.ikangtai.shecare.R;

/**
 * Created by Administrator on 2016/1/22.
 */
public class RecordSelectOvulationContentButton extends RecordSelectButton{

    private Context context;
    public static final int RECORD_Ovulation_SELECT_CONTENT_WHITE_BACKGROUND_COLOR = 0;
    public static final int RECORD_Ovulation_SELECT_CONTENT_PURPLE_BACKGROUND_COLOR = 1;
    public static final String RecordSelectContentOvulationButtonType ="BBTCONTENT";

    public RecordSelectOvulationContentButton(Context context){
        super(context);
        this.context=context;
        setType(RecordSelectContentOvulationButtonType);
    }
    public RecordSelectOvulationContentButton(Context context, AttributeSet attrs){
        super(context,attrs);
        this.context=context;
        this.backgroundColor = RECORD_Ovulation_SELECT_CONTENT_WHITE_BACKGROUND_COLOR;
    }
    @Override
    public void setColor(int backGroundColor) {
        super.setColor(backGroundColor);
        if(backGroundColor == RECORD_Ovulation_SELECT_CONTENT_WHITE_BACKGROUND_COLOR){
            this.setBackground(getResources().getDrawable(R.drawable.record_ovulation_button_default));
            this.setTextColor(getResources().getColor(R.color.ovulation_color));
        }else if(backGroundColor == RECORD_Ovulation_SELECT_CONTENT_PURPLE_BACKGROUND_COLOR){
            this.setBackground(getResources().getDrawable(R.drawable.record_ovulation_button_pressed));
            this.setTextColor(Color.WHITE);
        }
    }

    @Override
    public void clickAction(View view) {
        if(null!=view&&backgroundColor== RECORD_Ovulation_SELECT_CONTENT_WHITE_BACKGROUND_COLOR){
            if(backgroundColor == RECORD_Ovulation_SELECT_CONTENT_WHITE_BACKGROUND_COLOR){
                this.setBackground(getResources().getDrawable(R.drawable.record_ovulation_button_pressed));
                this.setTextColor(Color.WHITE);
                backgroundColor = RECORD_Ovulation_SELECT_CONTENT_PURPLE_BACKGROUND_COLOR;
            }
        }

    }
}
